using Koala.Pro.Common;
using System.Globalization;
using System.Windows.Data;

namespace Koala.Pro.Helpers;

public sealed class NumberToColorReConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value.ToBool())
        {
            return "green";
        }
        return "red";
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value == null || value.ToString().Equals("green", StringComparison.OrdinalIgnoreCase))
        {
            return 1;
        }
        return 0;
    }
}
